﻿using System;
//using System.Collections.Generic;
//using System.Collections.ObjectModel;
//using System.Linq;
//using System.Net;
using System.Windows;
using System.Windows.Controls;
//using System.Windows.Documents;
//using System.Windows.Input;
using System.Windows.Media;
//using System.Windows.Media.Animation;
//using System.Windows.Shapes;
using uhul.Controls;


namespace uhul
{
  public partial class XapExplorer : UserControl
  {


    /// <summary>
    /// ctor
    /// </summary>
    public XapExplorer()
    {

      if (_instance != null)
        throw new InvalidProgramException("cant create another instance of XapExplorer");

      InitializeComponent();

      _instance = this;
      this.AppTabContainer.SizeChanged += new SizeChangedEventHandler(XapExplorer.zmenaVelikostiAplikace);

    }





    /// <summary>
    /// handler for event when application resizes on screen and tab buttons mithg need to change width
    /// </summary>
    /// <param name="sender">tab buttons container</param>
    /// <param name="e"></param>
    private void AppViewPort_sizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
    {
      Grid g = (Grid)sender;
      g.Clip = new RectangleGeometry()
      {
        Rect = new Rect(0, 0, g.ActualWidth, g.ActualHeight)
      };
    }





    /// <summary>
    /// switch app to view of available application.
    /// Available applications are driven by AppMenu control, see control code for details
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void showAppMenu(object sender, RoutedEventArgs e)
    {
      this.AppLayout.Visibility = System.Windows.Visibility.Collapsed;
      this.NabidkaAplikaci.Visibility = System.Windows.Visibility.Visible;
    }




    /// <summary>
    /// shows running applications and their tabs to switch between
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void showApps(object sender, RoutedEventArgs e)
    {
      this.NabidkaAplikaci.Visibility = System.Windows.Visibility.Collapsed;
      this.AppLayout.Visibility = System.Windows.Visibility.Visible;
      
    }



  }
}
